<?php

use console\db\Migration;

/**
 * 俱乐部数据表
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m190102_180250_t_club extends Migration {

    /**
     * {@inheritdoc}
     */
    public function up() {

        /**
         * 俱乐部展示表
         * @table `club_show`
         */
        $this->tableBuilder([
            'name' => 'club_show',
            'comment' => '俱乐部展示表',
            'columns' => [
                'id' => $this->primaryKey(),
                'name' => $this->string(50)->notNull()->comment('招募活动名称'),
                'thumb' => $this->char(255)->defaultValue('')->comment('内容封面'),
                'icon' => $this->char(255)->defaultValue('')->comment('图标'),
                'description' => $this->string(255)->defaultValue('')->comment('简介'),
                'label' => $this->char(20)->defaultValue('')->comment('标签'),
                'format' => $this->tinyint(1)->notNull()->defaultValue(1)->comment('展示类型：0原生，1H5'),
                'content' => $this->text()->notNull()->comment('内容详情'),
                'listorder' => $this->integer(11)->unsigned()->notNull()->defaultValue(0)->comment('显示排序'),
                'status' => $this->tinyint(1)->notNull()->defaultValue(10)->comment('状态'),
                'created_at' => $this->unixTimestamp()->comment('创建时间'),
                'updated_at' => $this->unixTimestamp()->comment('更新时间'),
            ]
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function down() {
        $this->dropTable('{{%club_show}}');
    }

}
